#pragma once

#include <atlbase.h>
#include "mydsutil.h"
class CMediaBuffer;


class CFFEncodeFilter;

class CFFEncodeInputPin 
	:	public CBaseInputPin	
{
	friend class CFFEncodeFilter;
public:
	CFFEncodeInputPin(CBaseFilter *pFilter,CCritSec *pLock,HRESULT *phr,LPCWSTR pName, EMediaType streamType);
	virtual ~CFFEncodeInputPin();

	DECLARE_IUNKNOWN
	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
	
	HRESULT CheckMediaType(const CMediaType *pmt);
	HRESULT CompleteConnect(IPin *pReceivePin);
	HRESULT BreakConnect();
	HRESULT Active();
	HRESULT Inactive();

	STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
	STDMETHODIMP Receive(IMediaSample *pSample);
	STDMETHODIMP EndOfStream();

private:
	CCritSec m_csReceive;
	REFERENCE_TIME m_rtMaxStart, m_rtDuration;
	bool m_bEOS;
	CCritSec m_csListValid;
	CAMEvent m_validEvent;
	EMediaType m_eType;
	CMediaBuffer* m_pMediaBuffer;



};
